<script setup lang="ts">
import { computed, onMounted, onUpdated } from 'vue';
import { useRoute } from 'vue-router';

// 获取当前路由对象
const route = useRoute()
const currentPath = computed(() => {
    return route.path
})
onUpdated(() => {
    window.scrollTo({ top: 0, left: 0, behavior: 'smooth' })
})
</script>

<template>
    <div class="main-content no-scrollbar">
        <div v-if="currentPath == '/'">首页显示的内容</div>
        <RouterView v-else />
    </div>
</template>

<style scoped>
.main-content {
    height: calc(100vh - 60px);
    overflow-y: auto;
}

.no-scrollbar {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}
</style>